package com.example.system.base;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableLogic;
import com.example.system.tools.ValidatedGroup;
import lombok.Data;
import lombok.experimental.Accessors;
import org.hibernate.validator.constraints.Length;

import javax.validation.constraints.NotEmpty;
import java.io.Serializable;
import java.sql.Timestamp;

/**
 * @author hl
 */
@Data
@Accessors(chain = true)
public class BaseEntity implements Serializable {


    /**
     * 主键 // @Pattern()
     */
    @TableId(value = "guid", type = IdType.UUID)
    @NotEmpty(groups = ValidatedGroup.Update.class,message = "主键不能为空")
    @Length(groups = ValidatedGroup.Default.class, max = 32,message = "主键最大32个字符")
    private String guid;

    /**
     * 创建时间
     */
    @TableField("create_time")
    private Timestamp createTime;
    /**
     * 创建者
     */
    @TableField("creator")
    private String creator;

    /**
     * 修改时间
     */
    @TableField("modify_time")
    private Timestamp modifyTime;

    /**
     * 修改者
     */
    @TableField("modifier")
    private String modifier;

    /**
     * 状态：0-正常 1-已删除
     */
    @TableField("flag")
    @TableLogic
    private String flag;

}
